package com.hnx.admin.aurora.security.core;

import com.hnx.admin.aurora.security.api.PermissionValidator;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

/*
创建人： 倔强的头发
创建时间：2025/6/17
功能描述:

*/
@Component("auth")
@RequiredArgsConstructor
public class PermissionService {
    private final PermissionValidator permissionValidator;
    /**
     * 验证用户是否具备某权限
     *
     * @param permission 权限字符串
     * @return 用户是否具备某权限
     */
    public boolean hasPermi(String permission)
    {
        if (StringUtils.hasText(permission))
        {
            return permissionValidator.hasPermi(permission);
        }
        return false;
    }
}
